<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var a=0;
        var b=0;
        var maxLength = 0;
        var maxletter = "";
        function maxr(char) {
          while (a != char.length-1){
            if( char.charAt(a) == char.charAt(b)) {
              b++;
              console.log(b);
            } else { 
              if (b-a > maxLength) {
                maxLength= b- a;
                console.log(maxLength);
                maxletter = char.charAt(a);
              }
              a++;
              b = a + 1;
            }
          }
          console.log(maxletter);
        }
    </script>
</head>

<body>

</body>

</html>